package com.mydemo.listen;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class DemoListener {

    private static final Logger log= LoggerFactory.getLogger(DemoListener.class);

    //声明consumerID为demo，监听topicName为topic.quick.demo的Topic
    /*@KafkaListener(id = "demo", topics = "spring")
    public void listen(String msgData) {
        log.info("demo receive : "+msgData);
    }*/

    @KafkaListener(id = "CUPS", topics = "spring")
    public void listen1(ConsumerRecord<String, String> consumerRecord) {
        log.info("CUPS receive : "+consumerRecord.key() + "|" +consumerRecord.value());
    }

    @KafkaListener(id = "QRC", topics = "spring")
    public void listen2(String msgData) {
        log.info("QRC receive : "+msgData);
    }

    @KafkaListener(id = "ACP", topics = "spring")
    public void listen3(String msgData) {
        log.info("ACP receive : "+msgData);
    }
}
